const fs = require("fs");
const { Transform } = require("stream");

exports.default = () => {
    const read = fs.createReadStream("src/css/lx.css");
    const write = fs.createWriteStream("src/css/lx.min.css")
    const transform = new Transform({
        transform(chunk, encoding, callback) {
            let str = chunk.toString()
            let out = str.replace(/\s+/g, "").replace(/\/\*.+?\*\//g, "");
            callback(null, out)
        }
    })
    read.pipe(transform).pipe(write)
    return read
}